import Root from "./routes/root";
import ErrorPage from "./routes/error-page";
import {
	createBrowserRouter,
	RouterProvider,
} from "react-router-dom";
import Dashboard from './routes/Dashboard/components/index';
import Login from "./routes/Login/components";
import Register from "./routes/Register/components";
import MenuCRUD from "./routes/Menu/CRUD/components";
import RoleCRUD from "./routes/Role/CRUD/components";
import UserCRUD from "./routes/User/CRUD/components";
import Xxx from './routes/Xxx/components'
import UserLayout from "./layouts/UserLayout";

const router = createBrowserRouter([
	{
		path: '/sign',
		element: <UserLayout />,
		errorElement: <ErrorPage />,
		children: [
			{
				path: '/sign/login',
				element: <Login />
			},
			{
				path: '/sign/register',
				element: <Register />
			}
		]
	},
	{
		path: "/",
		element: <Root />,
		//element: <BasicLayout/>,
		errorElement: <ErrorPage />,
		children: [
			{
				path: '/',
				element: <Dashboard />
			},
			{
				path: '/menu',
				element: <MenuCRUD />
			},
			{
				path: '/user',
				element: <UserCRUD />
			},
			{
				path: '/role',
				element: <RoleCRUD />
			},
			{
				path: '/xxx',
				element: <Xxx />
			}
		]
	},
]);

function App() {
	return (
		<RouterProvider router={router} />
	)
}

App.whyDidYouRender = true

export default App